/*
 * Copyright (C) 2007,2008  Jonathan Hendler
 * 
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 * 
 * The authors can be contacted at: 
 * @author Jonathan Hendler [jonathan DOT hendler AT google DOT com]
 * 
 * @license GPLv2
 */

#ifndef BENCH_H_
#define BENCH_H_
/**
 * test suites
 * DB tests
 * JSON tests
 * UTF tests
 * LogicTests
 * 
 * Admin functions
 * 
 * */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <setjmp.h>
#include <time.h>
#include <sys/time.h>
#include "nymrl.h"

//http://www.ncsu.edu/itd/hpc/Documents/timing.html
#define NYMRL_TIMER_INIT struct timeval end;\
	double wdiff; \
	int ierr;\
	double seconds;\
	double total_total = 0;\
	double total_time;\
	double miliseconds;\
	struct timeval start;
	
#define NYMRL_TIMER_PRINT(a,b) printf("\n%s %d\t%f\n",a,b,total_time);
#define NYMRL_FINISH_ALL printf("\nTOTAL TIME FOR ALL TESTS:\t%f seconds.\n ",total_total);

#define NYMRL_TIMER_START \
	ierr= gettimeofday(&start, NULL); \
	if (ierr != 0 ) printf("bad return of gettime of day, ierr = %d \n", ierr); 

#define NYMRL_TIMER_END ierr = gettimeofday(&end, NULL);\
	if (ierr != 0 ) printf("bad return of gettime of day, ierr = %d \n", ierr);\
	seconds = end.tv_sec - start.tv_sec;\
	miliseconds = end.tv_usec - start.tv_usec;\
	wdiff = 1.e6*seconds + miliseconds; \
	total_time =  (wdiff/1.e6);\
	total_total = total_total+total_time;

	    
	    
	
	    
	            //fprintf(stdout, "\tresult '%s' ", sqlite3_column_text(stmt, j));
	        	//printf("%d",j);
	         




#endif 